import * as subjectsApi from '@/api/hmmm/subjects'

const subjects = {
  namespaced: true,
  state: {
    subjectsList: {},
    subjectsType: []
  },
  mutations: {
    SET_SUBJECTS_LIST (state, newValue) {
      state.subjectsList = newValue
    },
    SET_SUBJECTS_TYPE (state, newValue) {
      state.subjectsType = newValue
    }
  },
  actions: {
    async updateSubjectsList ({ commit }, params) {
      const res = await subjectsApi.list(params)
      commit('SET_SUBJECTS_LIST', res)
    },
    async updateSubjectsType ({ commit }) {
      const res = await subjectsApi.simple()
      commit('SET_SUBJECTS_TYPE', res)
    }
  }
}
export default subjects
